<?php


namespace App\Model;

use PhalApi\Model\NotORMModel as NotORM;

class Cart extends NotORM
{
    public function getCartInfoByUid($user_id)
    {
        return $this->getORM()->where('uid', $user_id)->fetchAll();
    }

    public function delCartById($userId)
    {
        return $this->getORM()->where('uid', $userId)->delete();
    }

    public function insertCartByUid($user_id)
    {
        $data = array('uid' => $user_id, 'money' => 0);
        $orm = $this->getORM();
        $orm->insert($data);
        return $orm->insert_id();
    }
}